/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.db;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "account_info")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AccountInfo.findAll", query = "SELECT a FROM AccountInfo a"),
    @NamedQuery(name = "AccountInfo.findById", query = "SELECT a FROM AccountInfo a WHERE a.id = :id"),
    @NamedQuery(name = "AccountInfo.findByAccountCode", query = "SELECT a FROM AccountInfo a WHERE a.accountCode = :accountCode"),
    @NamedQuery(name = "AccountInfo.findByAccountName", query = "SELECT a FROM AccountInfo a WHERE a.accountName = :accountName"),
    @NamedQuery(name = "AccountInfo.findByPipID", query = "SELECT a FROM AccountInfo a WHERE a.pipID = :pipID"),
    @NamedQuery(name = "AccountInfo.findByPwd", query = "SELECT a FROM AccountInfo a WHERE a.pwd = :pwd"),
    @NamedQuery(name = "AccountInfo.findByIsRisk", query = "SELECT a FROM AccountInfo a WHERE a.isRisk = :isRisk"),
    @NamedQuery(name = "AccountInfo.findByIid", query = "SELECT a FROM AccountInfo a WHERE a.iid = :iid"),
    @NamedQuery(name = "AccountInfo.findByType", query = "SELECT a FROM AccountInfo a WHERE a.type = :type"),
    @NamedQuery(name = "AccountInfo.findByInvestID", query = "SELECT a FROM AccountInfo a WHERE a.investID = :investID"),
    @NamedQuery(name = "AccountInfo.findByOwnUserID", query = "SELECT a FROM AccountInfo a WHERE a.ownUserID = :ownUserID"),
    @NamedQuery(name = "AccountInfo.findByAlterUserID", query = "SELECT a FROM AccountInfo a WHERE a.alterUserID = :alterUserID"),
    @NamedQuery(name = "AccountInfo.findByCreateTime", query = "SELECT a FROM AccountInfo a WHERE a.createTime = :createTime"),
    @NamedQuery(name = "AccountInfo.findByTimeStamp", query = "SELECT a FROM AccountInfo a WHERE a.timeStamp = :timeStamp")})
public class AccountInfo implements Serializable {
	public static byte[] EnCode(AccountInfo msg) throws IOException {
		Codec<AccountInfo> Lcode = ProtobufProxy.create(AccountInfo.class);
		return Lcode.encode(msg);
	}
	public static AccountInfo DeCode(byte[] data) throws IOException {
	Codec<AccountInfo> Lcode = ProtobufProxy.create(AccountInfo.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    @Protobuf
	private Integer id;
    @Basic(optional = false)
    @Column(name = "AccountCode")
    @Protobuf
	private String accountCode;
    @Column(name = "AccountName")
    private String accountName;
	@Protobuf
	private byte[] accountNameBit;
    @Basic(optional = false)
    @Column(name = "PipID")
    @Protobuf
	private int pipID;
    @Column(name = "Pwd")
    @Protobuf
	private String pwd;
    @Basic(optional = false)
    @Column(name = "RegionID")
    @Protobuf
	private String regionID;
    @Column(name = "IsRisk")
    @Protobuf
	private String isRisk;
    @Basic(optional = false)
    @Column(name = "iid")
    @Protobuf
	private int iid;
    @Column(name = "Type")
    @Protobuf
	private String type;
    @Column(name = "IType")
    @Protobuf
	private String itype;
    @Basic(optional = false)
    @Column(name = "InvestID")
    @Protobuf
	private String investID;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public AccountInfo() {
    }

    public AccountInfo(Integer id) {
        this.id = id;
    }

    public AccountInfo(Integer id, String accountCode, int pipID, int iid, String investID) {
        this.id = id;
        this.accountCode = accountCode;
        this.pipID = pipID;
        this.iid = iid;
        this.investID = investID;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getAccountCode() {
        return accountCode;
    }

    public void setAccountCode(String accountCode) {
        this.accountCode = accountCode;
    }

    public String getAccountName() {
        return accountName;
    }

    public void setAccountName(String accountName) {
        this.accountName = accountName;
        this.setAccountNameBit(CodeTool.StringToBit(accountName));
    }

    public int getPipID() {
        return pipID;
    }

    public void setPipID(int pipID) {
        this.pipID = pipID;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public String getIsRisk() {
        return isRisk;
    }

    public void setIsRisk(String isRisk) {
        this.isRisk = isRisk;
    }

    public int getIid() {
        return iid;
    }

    public void setIid(int iid) {
        this.iid = iid;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getInvestID() {
        return investID;
    }

    public void setInvestID(String investID) {
        this.investID = investID;
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AccountInfo)) {
            return false;
        }
        AccountInfo other = (AccountInfo) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.db.AccountInfo[ id=" + id + " ]";
    }

    public byte[] getAccountNameBit() {
        return accountNameBit;
    }

    public void setAccountNameBit(byte[] accountNameBit) {
        this.accountNameBit = accountNameBit;
		this.accountName = CodeTool.BitToString(accountNameBit);
    }

    public String getRegionID() {
        return regionID;
    }

    public void setRegionID(String regionID) {
        this.regionID = regionID;
    }

    public String getItype() {
        return itype;
    }

    public void setItype(String itype) {
        this.itype = itype;
    }
    
}
